source("http://phylo.wdfiles.com/local--files/biogeobears/cladoRcpp.R") # (needed now that traits model added; source FIRST!)
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_add_fossils_randomly_v1.R")
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_basics_v1.R")
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_calc_transition_matrices_v1.R")
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_classes_v1.R")
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_detection_v1.R")
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_DNA_cladogenesis_sim_v1.R")
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_extract_Qmat_COOmat_v1.R")
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_generics_v1.R")
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_models_v1.R")
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_on_multiple_trees_v1.R")
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_plots_v1.R")
source("http://phylo.wdfiles.com/local--files/biogeobears/BioGeoBEARS_readwrite_v1.R")
wd
pwd
# Install optimx
install.packages("optimx", dependencies=TRUE, repos="http://cran.rstudio.com")
# Also get snow (for parallel processing)
install.packages("snow")
library(snow)
# Install phylobase
install.packages("phylobase", dependencies=TRUE, repos="http://cran.rstudio.com")
# Install BioGeoBEARS from CRAN 0-cloud:
install.packages("BioGeoBEARS", dependencies=TRUE, repos="http://cran.rstudio.com")
install.packages(ggmap)
install.packages("ggmap", dependencies = TRUE)
library(ggmap)
get_map(location = c(lon=0,lat=0),zoom=1,maptype = "satellite")
?ggmap
ggmap(myMap)
ggmap(get_map)
myMap = get_map(location = c(lon=0,lat=0),zoom=1,maptype = "satellite")
ggmap(myMap)
myMap = get_map(location = c(lon=0,lat=0),zoom="auto",maptype = "satellite")
ggmap(myMap)
myMap = get_map(location = c(lon=0,lat=0),zoom=3,maptype = "satellite")
ggmap(myMap)
myMap = get_map(location = c(lon=0,lat=0),zoom=2,maptype = "satellite")
ggmap(myMap)
myMap = get_map(location = c(lon=0,lat=0),zoom=1,maptype = "satellite")
ggmap(myMap)
myMap = get_map(location = c(lon=0,lat=0),zoom=2,maptype = "satellite")
ggmap(myMap)
myMap = get_map(location = c(lon=0,lat=0),maprange = -180,maptype = "satellite")
myMap = get_map(location = c(lon=0,lat=160),maptype = "satellite")
myMap = get_map(location = c(lon=0,lat=0),maptype = "satellite")
library(maps)
library(plyr)
library(ggplot2)
library(sp)
library(ggmap)
# Get some points to plot - CRAN Mirrors
Mirrors = getCRANmirrors(all = FALSE, local.only = FALSE)
Mirrors$Place = paste(Mirrors$City, ", ", Mirrors$Country, sep = "")    # Be patient
tmp = geocode(Mirrors$Place)
Mirrors = cbind(Mirrors, tmp)
### Recenter ####
center <- 160 # positive values only
# shift coordinates to recenter CRAN Mirrors
Mirrors$long.recenter <- ifelse(Mirrors$lon < center - 180 , Mirrors$lon + 360, Mirrors$lon)
# shift coordinates to recenter worldmap
worldmap <- map_data ("world")
worldmap$long.recenter <- ifelse(worldmap$long < center - 180 , worldmap$long + 360, worldmap$long)
windows(9.2, 4)
worldmap = ggplot(aes(x = long.recenter, y = lat), data = worldmap.cp) +
geom_polygon(aes(group = group.regroup), fill="#f9f9f9", colour = "grey65") +
scale_y_continuous(limits = c(-60, 85)) +
coord_equal() +  theme_bw() +
theme(legend.position = "none",
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
#axis.text.x = element_blank(),
axis.text.y = element_blank(),
axis.ticks = element_blank(),
panel.border = element_rect(colour = "black"))
worldmap <- map_data ("world")
worldmap$long.recenter <- ifelse(worldmap$long < center - 180 , worldmap$long + 360, worldmap$long)
ggmap(worldmap)
ggmap(center)
require ("ggmap")
library ("png")
zoom <- 2
map <- readPNG (sprintf ("mapquest-world-%i.png", zoom))
map <- as.raster(apply(map, 2, rgb))
library(OpenStreetMap)
install.packages("OpenStreetMap")
library(OpenStreetMap)
library(ggplot2)
map <- openmap(c(70,-179),
c(-70,179),zoom=1)
map <- openproj(map)
reclat <- c(50,20,30,40)
reclong <- c(30,40,30,50)
autoplot(map) + geom_point(aes(x=reclong,y=reclat))
library(ggmap)
library(ggplot2)
reclat=c(50,20,30,40)
reclong=c(30,40,30,50)
points=as.data.frame(cbind(reclat,reclong))
al1 = get_map(location = 'Europe', zoom = 3, color="bw",maptype = "satellite")
map = ggmap(al1)
map
#this works
map+geom_point(data=points, aes(x=reclong, y=reclat, colour="red"))
reclat=c(50,20,30,40)
reclong=c(30,40,30,50)
points=as.data.frame(cbind(reclat,reclong))
al1 = get_map(location = 'Europe', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
#this works
map+geom_point(data=points, aes(x=reclong, y=reclat, colour="red"))
library(OpenStreetMap)
library(ggplot2)
map <- openmap(c(70,-179),
c(-70,179),zoom=1)
map <- openproj(map)
reclat <- c(50,20,30,40)
reclong <- c(30,40,30,50)
autoplot(map) + geom_point(aes(x=reclong,y=reclat))
library(OpenStreetMap)
install.packages("OpenStreetMap")
library(OpenStreetMap)
library("OpenStreetMap", lib.loc="/Library/Frameworks/R.framework/Versions/3.4/Resources/library")
library(ggplot2)
map <- openmap(c(70,-179),
c(-70,179),zoom=1)
library(ggmap)
library(ggplot2)
reclat=c(50,0,30,40)
reclong=c(0,40,30,50)
points=as.data.frame(cbind(reclat,reclong))
al1 = get_map(location = 'Europe', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
#this works
map+geom_point(data=points, aes(x=reclong, y=reclat, colour="red"))
#Using GGPLOT, plot the Base World Map
mp <- NULL
mapWorld <- borders("world", colour="gray50", fill="gray50") # create a layer of borders
mp <- ggplot() +   mapWorld
#Now Layer the cities on top
mp <- mp+ geom_point(aes(x=visit.x, y=visit.y) ,color="blue", size=3)
mp
library(ggmap)
library(ggplot2)
reclat=c(50,0,30,40)
reclong=c(0,40,30,50)
points=as.data.frame(cbind(reclat,reclong))
al1 = get_map(location = 'Europe', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
#this works
map+geom_point(data=points, aes(x=reclong, y=reclat, colour="red"))
reclong=c(-90,90)
points=as.data.frame(cbind(reclat,reclong))
al1 = get_map(location = 'world', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
reclat=c(-180,180)
reclong=c(-180,180)
points=as.data.frame(cbind(reclat,reclong))
al1 = get_map(location = 'world', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
#this works
map+geom_point(data=points, aes(x=reclong, y=reclat, colour="red"))
reclat=c(-170,10)
reclong=c(-180,180)
points=as.data.frame(cbind(reclat,reclong))
al1 = get_map(location = 'world', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
#this works
map+geom_point(data=points, aes(x=reclong, y=reclat, colour="red"))
library(ggmap)
library(ggplot2)
reclat=c(-170,10)
reclong=c(-90,100)
al1 = get_map(location = 'world', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
#this works
map+geom_point(aes(x=reclong, y=reclat, colour="red"))
reclat=c(-170,10)
reclong=c(-80,80)
points=as.data.frame(cbind(reclat,reclong))
al1 = get_map(location = 'world', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
#this works
map+geom_point(data=points, aes(x=reclong, y=reclat, colour="red"))
reclat=c(-170,10,-20,20)
reclong=c(-80,80,70,120)
points=as.data.frame(cbind(reclat,reclong))
al1 = get_map(location = 'world', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
#this works
map+geom_point(data=points, aes(x=reclong, y=reclat, colour="red"))
reclat=c(-170,10,-20,20)
reclong=c(-80,80,70,120)
al1 = get_map(location = 'world', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
reclat=c(-180,10)
reclong=c(-170,120)
points=as.data.frame(cbind(reclat,reclong))
al1 = get_map(location = 'world', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
?reclat
??reclat
?ggmap
library(ggmap)
library(ggplot2)
lat=c(-180,10)
long=c(-170,120)
al1 = get_map(location = 'world', zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
?maprange
library(ggmap)
library(ggplot2)
lat=c(10,-170)
long=c(170,-120)
al1 = get_map(location = 'world', maprange zoom = 3,maptype = "satellite")
lat=c(-10,70)
long=c(-170,120)
al1 = get_map(location = 'world', maprange zoom = 3,maptype = "satellite")
lat=c(-10,70)
long=c(-170,120)
al1 = get_map(location = 'world',zoom = 3,maptype = "satellite")
map = ggmap(al1)
map
bbox <- c(left = -170, bottom = -60, right = 170, top = 80)
ggmap(get_stamenmap(bbox, zoom = 3, maptype="toner"), extent = "device")
ggmap(get_stamenmap(bbox, zoom = 3, maptype="satellite"), extent = "device")
bbox <- c(left = -170, bottom = -60, right = 170, top = 80)
ggmap(get_stamenmap(bbox, zoom = 3, maptype="satellite"), extent = "device")
ggmap(get_stamenmap(bbox, zoom = 3, maptype="terrain"), extent = "device")
bbox <- c(left = -170, bottom = -60, right = 170, top = 80)
ggmap(get_stamenmap(bbox, zoom = 3, maptype="terrain"), extent = "device")
myMap <- get_map(location = "World",
source = "google",
maptype = "terrain", crop = FALSE)
get_map(location = -179,-120,179,30)
?get_map
install.packages("ggtree")
?ne_countries
library("ggplot2")
theme_set(theme_bw())
library("sf")
library("rnaturalearth")
library("rnaturalearthdata")
library("rgeos")
?ne_countries
install.packages('DNABarcodes')
source("https://bioconductor.org/biocLite.R")
biocLite("DNABarcodes")
library("DNABarcodes")
#UCE first set, then TruSeq CD indexes
i5barcodes <- c("ATGACAGG","GAATGGCA","ATGCGCTT","GAAGATCC","ATGGCGAT","TACAGAGC","ATGTGGAC","GACACAGT","TATAGCCT","ATAGAGGC")
#UCE first set, then TruSeq CD indexes
i7barcodes <- c("ATAAGGCG","CTTACCTG","CGTTGCAA","GATTCAGC","TCACGTTC","TGTGCGTT","TAGTTGCG","AAGAGCCA","ACAGCTCA","AAGCCACA","ACACGGTT","GAGATTCC","ATTCAGAA","GAATTCGT","CTGAAGCT","TAATGCGC","CGGCTATG","TCCGCGAA","TCTCGCGC","AGCGATAG")
barcode.set.distances(i5barcodes, metric=c("seqlev"))
analyse.barcodes(i5barcodes, metric=c("seqlev"))
barcode.set.distances(i7barcodes, metric=c("seqlev"))
analyse.barcodes(i7barcodes, metric=c("seqlev"))
library("ggplot2")
theme_set(theme_bw())
library("sf")
library("rnaturalearth")
library("rnaturalearthdata")
library("rgeos")
world <- ne_countries(scale = "medium", returnclass = "sf")
class(world)
ggplot(data = world) +
geom_sf(color = "gray60", fill = "gray92") +
coord_sf(crs = "+proj=moll +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs") +
coord_sf(xlim = c(-98, 185), ylim = c(48, -72.1), expand = FALSE) +
#geom_jitter(data = not_sampled,height = .02, width = 0.02, aes(x=not_sampled$Longitude, y=not_sampled$Latitude), size=2.8, shape=21, fill="grey60", color = "black")+
#geom_jitter(data = all_localities, height=.02,width=.02, aes(x = all_localities$Longitude, y = all_localities$Latitude), size = 3, shape = 21, fill = all_localities$HEX, color = all_localities$HEX, alpha = 0.67) +
theme(axis.title = element_blank())
setwd("~/Dropbox/Onychophora_phylogeny/[ Nucleotides ]/nexus-matrices/")
matriz <- read.table("50perc_occ_matrix.tsv", header=T, sep="\t")
rownames(matriz) <- matriz$filename # Gives OG names as rownames
matriz <- matriz[,colnames(matriz)!="filename"] # Removes column of OG file names
# Order matrix to show higher occupancy on top left corner
matriz <- matriz[order(rowSums(matriz), decreasing=T),]
matriz <- matriz[,order(colSums(matriz), decreasing=F)]
# Changes 0 for 2 in first X (e.g. 88) genes, for different color of smaller matrix
matriz[1:88,][matriz[1:88,]=="0"] <- as.integer("2")
pdf(file="matrix.pdf", width=4.5, height=2.25) # Image size in inches
par(mar=c(2,1,1,1)) # Margin without species names
image(x=1:dim(matriz)[1],y=1:dim(matriz)[2],as.matrix(matriz),col=c("orange2", "black", "steelblue"),yaxt='n',xaxt='n')
axis(1,at=c(88,200,400,600,800), tick=T, las=1, cex.axis=1) # X axis ticks
dev.off()
# Changes 0 for 2 in first X (e.g. 88) genes, for different color of smaller matrix
matriz[1:160,][matriz[1:160,]=="0"] <- as.integer("2")
pdf(file="matrix.pdf", width=4.5, height=2.25) # Image size in inches
par(mar=c(2,1,1,1)) # Margin without species names
image(x=1:dim(matriz)[1],y=1:dim(matriz)[2],as.matrix(matriz),col=c("orange2", "black", "steelblue"),yaxt='n',xaxt='n')
axis(1,at=c(160,200,400,600,800,1000), tick=T, las=1, cex.axis=1) # X axis ticks
dev.off()
